﻿#region Using Directives

    using System;

    using Csla;

    using MarketPulse.BusinessLogic.Core;

#endregion

namespace MarketPulse.BusinessLogic.Common
{
    /// <summary>
    /// This class represents a read only instance of a Language within the system.
    /// </summary>
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.DataAccess.Factory.LanguageFactory, MarketPulse.DataAccess.Factory", "FetchInfo")]
    public class LanguageInfo : MarketPulseReadOnlyBase<LanguageInfo>
    {       

        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// only via the static factory methods provided.
            /// </summary>
            private LanguageInfo()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods

                /// <summary>
                /// Method used to retrieve a Language info object 
                /// </summary>
                /// <param name="guid">The guid of the Language info object to retrieve</param>
                /// <returns>The populated Language info object survey</returns>
                public static LanguageInfo Get(Guid guid)
                {
                    return DataPortal.Fetch<LanguageInfo>(new SingleCriteria<Guid>(guid));
                }

            #endregion

        #endregion

        #region Properties

            /// <summary>A human readable name for this Language/summary>
            public static PropertyInfo<string> LanguageNameProperty = RegisterProperty<string>(p => p.LanguageName);
            /// <summary>A human readable name for this Language</summary>
            public string LanguageName
            {
                get { return GetProperty(LanguageNameProperty); }
            }

            /// <summary>A human readable, localised name for this language</summary>
            public static PropertyInfo<string> LocalLanguageNameProperty = RegisterProperty<string>(p => p.LocalLanguageName);
            /// <summary>A human readable, localised name for this language</summary>
            public string LocalLanguageName
            {
                get { return GetProperty(LocalLanguageNameProperty); }
            }

            /// <summary>Two character ISO code for the language</summary>
            public static PropertyInfo<string> LanguageISOCode2Property = RegisterProperty<string>(p => p.LanguageISOCode2);
            /// <summary>Two character ISO code for the language</summary>
            public string LanguageISOCode2
            {
                get { return GetProperty(LanguageISOCode2Property); }
            }

            /// <summary>Three character ISO code for the language</summary>
            public static PropertyInfo<string> LanguageISOCode3Property = RegisterProperty<string>(p => p.LanguageISOCode3);
            /// <summary>Three character ISO code for the language</summary>
            public string LanguageISOCode3
            {
                get { return GetProperty(LanguageISOCode3Property); }
            }

        #endregion
    }
}
